export default ({ request, serviceForMock, mock, faker }) => {

  // Mock数据配置 - 不包括权限管理和基础配置
  mock.onGet('/system/operation-log/list').reply(200, {
    code: 0,
    msg: 'success',
    data: {
      page: {
        totalCount: 200,
        pageSize: 10,
        totalPage: 20,
        currPage: 1,
        list: Array.from({ length: 10 }, (_, index) => ({
          id: index + 1,
          operator: faker.name.findName(),
          operation: ['用户登录', '数据修改', '系统配置', '用户注销'][index % 4],
          module: ['用户管理', '租户管理', '设备管理', '财务管理'][index % 4],
          ip: faker.internet.ip(),
          operationTime: faker.date.recent().toISOString().replace('T', ' ').split('.')[0],
          result: ['成功', '失败'][index % 2],
          description: faker.lorem.sentence()
        }))
      }
    }
  })

  mock.onGet('/system/charge-plan/list').reply(200, {
    code: 0,
    msg: 'success',
    data: {
      page: {
        totalCount: 15,
        pageSize: 10,
        totalPage: 2,
        currPage: 1,
        list: Array.from({ length: 10 }, (_, index) => ({
          id: index + 1,
          planName: `收费方案${index + 1}`,
          electricPrice: faker.random.number({ min: 0.5, max: 1.5 }),
          waterPrice: faker.random.number({ min: 2, max: 8 }),
          serviceCharge: faker.random.number({ min: 5, max: 20 }),
          status: ['启用', '禁用'][index % 2],
          createTime: faker.date.past().toISOString().split('T')[0],
          description: faker.lorem.sentence()
        }))
      }
    }
  })

  mock.onGet('/system/schedule-plan/list').reply(200, {
    code: 0,
    msg: 'success',
    data: {
      page: {
        totalCount: 8,
        pageSize: 10,
        totalPage: 1,
        currPage: 1,
        list: Array.from({ length: 8 }, (_, index) => ({
          id: index + 1,
          planName: `定时方案${index + 1}`,
          scheduleType: ['每日', '每周', '每月'][index % 3],
          executeTime: `${String(Math.floor(Math.random() * 24)).padStart(2, '0')}:${String(Math.floor(Math.random() * 60)).padStart(2, '0')}`,
          action: ['自动抄表', '账单生成', '余额提醒'][index % 3],
          status: ['启用', '禁用'][index % 2],
          lastExecute: faker.date.recent().toISOString().replace('T', ' ').split('.')[0]
        }))
      }
    }
  })

  mock.onGet('/system/subsidy-plan/list').reply(200, {
    code: 0,
    msg: 'success',
    data: {
      page: {
        totalCount: 5,
        pageSize: 10,
        totalPage: 1,
        currPage: 1,
        list: Array.from({ length: 5 }, (_, index) => ({
          id: index + 1,
          planName: `补助方案${index + 1}`,
          subsidyType: ['电费补助', '水费补助', '综合补助'][index % 3],
          subsidyAmount: faker.random.number({ min: 10, max: 100 }),
          subsidyPeriod: ['每月', '每季度', '每年'][index % 3],
          targetGroup: ['全体租户', '特定群体'][index % 2],
          status: ['启用', '禁用'][index % 2],
          createTime: faker.date.past().toISOString().split('T')[0]
        }))
      }
    }
  })

  return {
    // 操作记录
    system_operation_log_list(params = {}) {
      return request({
        url: '/system/operation-log/list',
        params
      })
    },

    // 收费方案
    system_charge_plan_list(params = {}) {
      return request({
        url: '/system/charge-plan/list',
        params
      })
    },

    system_charge_plan_info(params = {}) {
      return request({
        url: '/system/charge-plan/info/' + params.id,
        params
      })
    },

    system_charge_plan_save(data = {}) {
      return request({
        url: '/system/charge-plan/save',
        method: 'post',
        data
      })
    },

    system_charge_plan_update(data = {}) {
      return request({
        url: '/system/charge-plan/update',
        method: 'post',
        data
      })
    },

    system_charge_plan_delete(data = {}) {
      return request({
        url: '/system/charge-plan/delete',
        method: 'post',
        data
      })
    },

    // 定时方案
    system_schedule_plan_list(params = {}) {
      return request({
        url: '/system/schedule-plan/list',
        params
      })
    },

    system_schedule_plan_info(params = {}) {
      return request({
        url: '/system/schedule-plan/info/' + params.id,
        params
      })
    },

    system_schedule_plan_save(data = {}) {
      return request({
        url: '/system/schedule-plan/save',
        method: 'post',
        data
      })
    },

    system_schedule_plan_update(data = {}) {
      return request({
        url: '/system/schedule-plan/update',
        method: 'post',
        data
      })
    },

    system_schedule_plan_delete(data = {}) {
      return request({
        url: '/system/schedule-plan/delete',
        method: 'post',
        data
      })
    },

    // 补助方案
    system_subsidy_plan_list(params = {}) {
      return request({
        url: '/system/subsidy-plan/list',
        params
      })
    },

    system_subsidy_plan_info(params = {}) {
      return request({
        url: '/system/subsidy-plan/info/' + params.id,
        params
      })
    },

    system_subsidy_plan_save(data = {}) {
      return request({
        url: '/system/subsidy-plan/save',
        method: 'post',
        data
      })
    },

    system_subsidy_plan_update(data = {}) {
      return request({
        url: '/system/subsidy-plan/update',
        method: 'post',
        data
      })
    },

    system_subsidy_plan_delete(data = {}) {
      return request({
        url: '/system/subsidy-plan/delete',
        method: 'post',
        data
      })
    }
  }
}

